//总消息页面：历史消息
var MessageIndexCtrl = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', function ($scope, $rootScope, messageRead, messageHistory, ShopSetCheck) {
        ShopSetCheck();
        messageHistory().then(function (data) {
            $scope.news_list = data;
        });
    }];
//公示标题
var NoticeNavCtrl = ['$scope', '$rootScope', '$routeParams', 'VIP', '$location', function ($scope, $rootScope, $routeParams, VIP, $location) {
        $scope.menu_list = [
			{name: "企业文化", url: "#notice/qywh", id: "qywh", show: 1 },
			{name: "流程制度", url: "#notice/lczd", id: "lczd", show: 1 },
			{name: "廉政建设", url: "#notice/lz", id: "lzjs", show: 1 }
        ];
	}];
//企业文化
var QywhIndexCtrl = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', 'apiService', '$location', function ($scope, $rootScope, messageRead, messageHistory, ShopSetCheck, apiService, $location) {
		apiService('base/culture/get_culture_list', {}).then(function (ret) {
			var data = ret.data.data;
			var objs = [];
			$scope.culture_title = data.culture_title;
			$scope.url = data.url;
			for(var key in data){
				var value = data[key];
				if(typeof value == "object"){
					var content = value.content;
					var title = value.culture_title || "";
					var arr = content.split(";");
					var srcs = [];
					for(var i=0;i<arr.length;i++){
						if(arr[i].indexOf("upload/cms")>=0){
							var src = $scope.url+arr[i].split("&quot")[0];
							srcs.push(src);							
						}
					}
					for(var i=0;i<arr.length;i++){
						if(arr[i].indexOf("upload/cms")>=0){
							var src = $scope.url+arr[i].split("&quot")[0];
							var obj = {"src":src,"title":title,"srcs":srcs};	
							objs.push(obj);	
							break;
						}
					}
				}
			};
			$scope.srcs = objs;
			//http://192.168.253.175/devefast365/manage/web/upload/cms/20170901/20170901160932.gif
        }).catch(function (err) {
            baison_app.api.toast({msg: "企业文化信息解析失败"}); 
        });	
		$scope.curr = 'qywh';
		$scope.click = function(obj){
			$rootScope.gongshichakan = {"obj":obj,"curr":$scope.curr} ;
			$location.path('/notice/chakan');
		}
    }];
//流程制度
var LczdIndexCtrl = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', 'apiService', '$location',function ($scope, $rootScope, messageRead, messageHistory, ShopSetCheck, apiService , $location) {
		apiService('base/process/get_culture_list', {}).then(function (ret) {
			var data = ret.data.data;
			var objs = [];
			$scope.culture_title = data.culture_title;
			$scope.url = data.url;
			for(var key in data){
				var value = data[key];
				if(typeof value == "object"){
					var content = value.content;
					var title = value.culture_title || "";
					var arr = content.split(";");
					var srcs = [];
					for(var i=0;i<arr.length;i++){
						if(arr[i].indexOf("upload/cms")>=0){
							var src = $scope.url+arr[i].split("&quot")[0];
							srcs.push(src);							
						}
					}
					for(var i=0;i<arr.length;i++){
						if(arr[i].indexOf("upload/cms")>=0){
							var src = $scope.url+arr[i].split("&quot")[0];
							var obj = {"src":src,"title":title,"srcs":srcs};	
							objs.push(obj);	
							break;
						}
					}
				}
			};
			$scope.srcs = objs;
			//http://192.168.253.175/devefast365/manage/web/upload/cms/20170901/20170901160932.gif
        }).catch(function (err) {
            baison_app.api.toast({msg: "流程制度信息解析失败"}); 
        });	
		$scope.curr = 'lczd';
		$scope.click = function(obj){
			$rootScope.gongshichakan = {"obj":obj,"curr":$scope.curr} ;
			$location.path('/notice/chakan');
		}
    }];
//廉政
var LzIndexCtrl = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', 'apiService', '$location' , function ($scope, $rootScope, messageRead, messageHistory, ShopSetCheck, apiService , $location) {
		apiService('base/incorrupt/get_culture_list', {}).then(function (ret) {
			var data = ret.data.data;
			var objs = [];
			$scope.culture_title = data.culture_title;
			$scope.url = data.url;
			for(var key in data){
				var value = data[key];
				if(typeof value == "object"){
					var content = value.content;
					var title = value.culture_title || "";
					var arr = content.split(";");
					var srcs = [];
					for(var i=0;i<arr.length;i++){
						if(arr[i].indexOf("upload/cms")>=0){
							var src = $scope.url+arr[i].split("&quot")[0];
							srcs.push(src);							
						}
					}
					for(var i=0;i<arr.length;i++){
						if(arr[i].indexOf("upload/cms")>=0){
							var src = $scope.url+arr[i].split("&quot")[0];
							var obj = {"src":src,"title":title,"srcs":srcs};	
							objs.push(obj);
							break;							
						}
					}
				}
			};
			$scope.srcs = objs;
			//http://192.168.253.175/devefast365/manage/web/upload/cms/20170901/20170901160932.gif
        }).catch(function (err) {
            baison_app.api.toast({msg: "廉政信息解析失败"}); 
        });	
		$scope.curr = 'lzjs';
		$scope.click = function(obj){
			$rootScope.gongshichakan = {"obj":obj,"curr":$scope.curr} ;
			$location.path('/notice/chakan');
		}
    }];
//查看
var ChakanIndexCtrl = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', 'apiService', '$location' , '$routeParams', function ($scope, $rootScope, messageRead, messageHistory, ShopSetCheck, apiService , $location , $routeParams) {
		$scope.record_code = $rootScope.gongshichakan.obj;
		$scope.curr = $rootScope.gongshichakan.curr
    }];
	
//OA
var OaIndexCtrl = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', '$location', function ($scope, $rootScope, messageRead, messageHistory, ShopSetCheck, $location) {
		var oa = document.getElementById("iframe");
		oa.src = "http://pre.onehrcloud.com/precloud/";
		$scope.close = function(){
			$location.path('/index');
		};
    }];
NoticeNavCtrl.$injector = ['$scope', '$rootScope', '$routeParams', 'VIP', '$location'];	
MessageIndexCtrl.$injector = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck'];
QywhIndexCtrl.$injector = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', 'apiService' ,'$location'];
LczdIndexCtrl.$injector = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', 'apiService' ,'$location'];
LzIndexCtrl.$injector = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', 'apiService' ,'$location'];
ChakanIndexCtrl.$injector = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck', 'apiService' ,'$location', '$routeParams'];
OaIndexCtrl.$injector = ['$scope', '$rootScope', 'messageRead', 'messageHistory', 'ShopSetCheck','$location'];
